package com.oa.pm.controller;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.joneying.common.web.response.Resp;
import com.oa.pm.service.IRegionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Description;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Api(description = "地区")
@RestController
@RequestMapping("/region")
public class RegionController {

    @Autowired
    private IRegionService regionService;


    @RequestMapping("/list")
    @Description("查询所有")
    @ApiOperation(value = "查询(1=省)")
    public Resp findList(@ApiParam("父ID") @RequestParam("fid") String fid){
        Wrapper wrapper = new EntityWrapper();
        wrapper.where("fid = {0}", fid);
        return new Resp().success(regionService.selectList(wrapper));
    }
}
